package com.hanliy.controller;

import com.hanliy.dto.AdminDTO;
import com.hanliy.dto.Result;
import com.hanliy.invalidate.Save;
import com.hanliy.invalidate.Update;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author hanyulin
 * @apiNote 测试分组校验
 * @date 2021/12/12 22:38
 */
@RestController
@RequestMapping(("/admin"))
public class AdminController {

    /**
     * 测试单个分组校验
     *
     * @param adminDTO 分组dto
     * @author hanyulin
     * @date 2021/12/12 22:46
     * @return Result
     */
    @PostMapping
    public Result save(@Validated(value = Save.class) @RequestBody AdminDTO adminDTO){
        return new Result().ok();
    }
    /**
     * 测试多个分组校验
     *
     * @param adminDTO 分组测试dto
     * @author hanyulin
     * @date 2021/12/12 22:51
     * @return com.hanliy.dto.Result
     */
    @GetMapping
    public Result update(@Validated(value = {Update.class,Save.class}) @RequestBody AdminDTO adminDTO){
        return new Result().ok();
    }

}
